@echo off
echo 启动后端服务...

rem 设置Java环境
set "JAVA_HOME=C:\Program Files\Java\jdk-17"
set "MAVEN_HOME=D:\apache-maven-3.9.9-bin\apache-maven-3.9.9"
set "PATH=%JAVA_HOME%\bin;%MAVEN_HOME%\bin;%PATH%"

rem 验证Java安装
echo 验证Java安装...
java -version
if errorlevel 1 (
    echo Java未正确安装或JAVA_HOME设置错误
    pause
    exit /b 1
)

rem 验证Maven安装
echo 验证Maven安装...
mvn -version
if errorlevel 1 (
    echo Maven未正确安装或MAVEN_HOME设置错误
    pause
    exit /b 1
)

echo 清理并编译项目...
call mvn clean compile

echo 启动Spring Boot应用...
call mvn spring-boot:run

pause 